

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>登入 - layuiAdmin</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="layuiadmin/style/login.css" media="all">
</head>
<body>

<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>WCSS</h2>
            <p>WCSS 寒衣补助系统</p>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-username" ></label>
                <input type="text" name="sn" id="sn" lay-verify="required" placeholder="学号/工号" class="layui-input">
                <!--表单验证，预设元素属性-->
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-password" ></label>
                <input type="password" name="password" id="password" lay-verify="required" placeholder="密码" class="layui-input">
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" lay-filter="login" lay-submit id="login">登 入</button>
                <!--lay-filter事件过滤器-->
            </div>
            <div class="layui-trans layui-form-item layadmin-user-login-other">
                <label>社交账号登入</label>
                <a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
                <a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
                <a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>

                <a href="reg.html" class="layadmin-user-jump-change layadmin-link">注册帐号</a>
            </div>
        </div>
    </div>

    <div class="layui-trans layadmin-user-login-footer">

        <p>© 2018 <a href="http://www.layui.com/" target="_blank">layui.com</a></p>
        <p>
            <span><a href="http://www.layui.com/admin/#get" target="_blank">获取授权</a></span>
            <span><a href="http://www.layui.com/admin/pro/" target="_blank">在线演示</a></span>
            <span><a href="http://www.layui.com/admin/" target="_blank">前往官网</a></span>
        </p>
    </div>



</div>

<script src="layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: 'layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'user','layer'], function(){
        var $ = layui.$
            ,layer=layui.layer
            ,setter = layui.setter
            ,admin = layui.admin
            ,form = layui.form
            ,router = layui.router()
            ,search = router.search;
        //form.on 表单事件触发 根据参数选出触发的不同事件
        form.on("submit(login)",function (data) {
            //事件出发发送AJax请求
            $.ajax({
                        type: 'post',
                        url: "/whitelistSetting/login",
                        data: data.field,
                        success: function (res) {
                            if(res.data===null){
                                layer.msg("用户名或密码错误",{icon:5,time:1500})
                            }else{
                                layer.msg("登陆成功",{icon:6,time:1500},function () {
                                    /*跳转首页*/
                                    window.location='/index'
                                })
                            }
                        }
                    })
        })

        // $("#login").click(function () {
        //     var sn=$("#sn").val()
        //     var password=$("#password").val()
        //
        //     $.ajax({
        //         type: 'post',
        //         url: "/whitelistSetting/login",
        //         data: {
        //             sn: sn,
        //             password: password
        //         },
        //         success: function (res) {
        //             if(res.data===null){
        //                 layer.msg("用户名或密码错误",{icon:5,time:1500})
        //             }else{
        //                 layer.msg("登陆成功",{icon:6,time:1500},function () {
        //                     window.location='/index'
        //                 })
        //             }
        //         }
        //     })
        // })

    });
</script>
</body>
</html>